package com.cdvtc.news.web.admin;

import com.cdvtc.news.entity.Tag;
import com.cdvtc.news.service.TagService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping("/admin/tag")
public class TagController {

    @Autowired
    private TagService tagService;

    @RequestMapping
    public String list(Model model) {
        List<Tag> tagList = tagService.getAllTags();
        model.addAttribute("tagList", tagList);
        return "admin/tag-list";
    }
}
